package logic

import (
	"context"
	"good_srv/good"
	"good_srv/internal/svc"
	"good_srv/models"

	"github.com/zeromicro/go-zero/core/logx"
)

type RiderContentLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRiderContentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RiderContentLogic {
	return &RiderContentLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 骑手评论添加
func (l *RiderContentLogic) RiderContent(in *good.RiderContentRequest) (*good.RiderContentResponse, error) {
	// todo: add your logic here and delete this line
	var err error
	contents := models.RiderContent{
		RiderId: in.RiderId,
		OrderId: in.OrderId,
		Content: in.Content,
		Score:   in.Score,
		Image:   in.Image,
	}
	if err = contents.RAdd(); err != nil {
		logx.Error("订单对骑手评论添加成功")
	}
	return &good.RiderContentResponse{
		Id: int64(contents.ID),
	}, nil
}
